﻿#include "FITKAbaAmplitudeTabular.h"


Interface::FITKAbaAbstractAmplitude::TimeSpan Interface::AmplitudeTabularData::getTimeSpan() const
{
    return m_timeSpan;
}

void Interface::AmplitudeTabularData::setTimeSpan(FITKAbaAbstractAmplitude::TimeSpan type)
{
    m_timeSpan = type;
}

Interface::FITKAbaAbstractAmplitude::SmoothingType Interface::AmplitudeTabularData::getSmoothingType() const
{
    return m_smoothing;
}

void Interface::AmplitudeTabularData::setSmoothingType(FITKAbaAbstractAmplitude::SmoothingType type)
{
    m_smoothing = type;
}

double Interface::AmplitudeTabularData::getSmoothingValue() const
{
    return m_smoothingValue;
}

void Interface::AmplitudeTabularData::setSmoothingValue(double value)
{
    m_smoothingValue = value;
}

Interface::FITKAbaAbstractAmplitude::BaselineCorrection Interface::AmplitudeTabularData::getBaseLineCorrection() const
{
    return m_baseLineCorrection;
}

void Interface::AmplitudeTabularData::setBaseLineCorrection(FITKAbaAbstractAmplitude::BaselineCorrection type)
{
    m_baseLineCorrection = type;
}

int Interface::AmplitudeTabularData::getNumberOfRows() const
{
    return m_amplitudeData.size();
}

void Interface::AmplitudeTabularData::setNumberOfRows(int num)
{
    m_amplitudeData.resize(num);
}

void Interface::AmplitudeTabularData::insertRow(int index)
{
    m_amplitudeData.insert(index, QPair<double, double>{0.0,0.0});
}

void Interface::AmplitudeTabularData::removeRow(int index)
{
    if (index >= 0 && index < m_amplitudeData.size())
    {
        m_amplitudeData.removeAt(index);
    }
}

double Interface::AmplitudeTabularData::getTime(int index) const
{
    if (index >= 0 && index < m_amplitudeData.size())
        return m_amplitudeData.at(index).first;
    return 0.0;
}

double Interface::AmplitudeTabularData::getAmplitude(int index) const
{
    if (index >= 0 && index < m_amplitudeData.size())
        return m_amplitudeData.at(index).second;
    return 0.0;
}

void Interface::AmplitudeTabularData::setTime(double value, int index)
{
    if (index >= 0 && index < m_amplitudeData.size())
        m_amplitudeData[index].first = value;
}

void Interface::AmplitudeTabularData::setAmplitude(double value, int index)
{
    if (index >= 0 && index < m_amplitudeData.size())
        m_amplitudeData[index].second = value;
}

int Interface::AmplitudeTabularData::getNumberOfRowsOfMultipleIntervals() const
{
    return m_correctionMultiIntervals.size();
}

void Interface::AmplitudeTabularData::setNumberOfRowsOfMultipleIntervals(int rowCount)
{
    if (rowCount >= 1)
        m_correctionMultiIntervals.resize(rowCount);
}

void Interface::AmplitudeTabularData::removeRowOfMultipleIntervals(int index)
{
    if (m_correctionMultiIntervals.size() == 1)
        return;
    if (index >= 0 && index < m_correctionMultiIntervals.size())
        m_correctionMultiIntervals.removeAt(index);
}

void Interface::AmplitudeTabularData::insertRowOfMultipleIntervals(double value, int index)
{
    if (index >= 0 && index < m_correctionMultiIntervals.size())
        m_correctionMultiIntervals.insert(value, index);
}

double Interface::AmplitudeTabularData::getMultipleInterval(int index) const
{
    if (index >= 0 && index < m_correctionMultiIntervals.size())
        return m_correctionMultiIntervals.at(index);
    return 0.0;
}

void Interface::AmplitudeTabularData::setMultipleInterval(double value, int index)
{
    if (index >= 0 && index < m_correctionMultiIntervals.size())
        m_correctionMultiIntervals[index] = value;
}

Interface::FITKAbaAbstractAmplitude::FITKAbaAmplitudeType Interface::FITKAbaAmplitudeTabular::getAmplitudeType() const
{
    return FITKAbaAmplitudeType::Tabular;
}

bool Interface::FITKAbaAmplitudeTabular::copy(FITKAbstractDataObject *obj)
{
    FITKAbaAmplitudeTabular* tabular = dynamic_cast<FITKAbaAmplitudeTabular*>(obj);
    if (tabular == nullptr)
        return false;
    this->setDataObjectName(tabular->getDataObjectName());
    this->m_data = tabular->m_data;
}

Interface::FITKAbaAbstractAmplitude::TimeSpan Interface::FITKAbaAmplitudeTabular::getTimeSpan() const
{
    return m_data.getTimeSpan();
}

void Interface::FITKAbaAmplitudeTabular::setTimeSpan(TimeSpan type)
{
    m_data.setTimeSpan(type);
}

Interface::FITKAbaAbstractAmplitude::SmoothingType Interface::FITKAbaAmplitudeTabular::getSmoothingType() const
{
    return m_data.getSmoothingType();
}

void Interface::FITKAbaAmplitudeTabular::setSmoothingType(SmoothingType type)
{
    m_data.setSmoothingType(type);
}

double Interface::FITKAbaAmplitudeTabular::getSmoothingValue() const
{
    return m_data.getSmoothingValue();
}

void Interface::FITKAbaAmplitudeTabular::setSmoothingValue(double value)
{
    m_data.setSmoothingValue(value);
}

Interface::FITKAbaAbstractAmplitude::BaselineCorrection Interface::FITKAbaAmplitudeTabular::getBaseLineCorrection() const
{
    return m_data.getBaseLineCorrection();
}

void Interface::FITKAbaAmplitudeTabular::setBaseLineCorrection(BaselineCorrection type)
{
    m_data.setBaseLineCorrection(type);
}

int Interface::FITKAbaAmplitudeTabular::getNumberOfRows() const
{
    return m_data.getNumberOfRows();
}

void Interface::FITKAbaAmplitudeTabular::setNmberOfRows(int num)
{
    m_data.setNumberOfRows(num);
}

void Interface::FITKAbaAmplitudeTabular::insertRow(int index)
{
    m_data.insertRow(index);
}

void Interface::FITKAbaAmplitudeTabular::removeRow(int index)
{
    m_data.removeRow(index);
}

double Interface::FITKAbaAmplitudeTabular::getTime(int index) const
{
    return m_data.getTime(index);
}

double Interface::FITKAbaAmplitudeTabular::getAmplitude(int index) const
{
    return m_data.getAmplitude(index);
}

void Interface::FITKAbaAmplitudeTabular::setTime(double value, int index)
{
    m_data.setTime(value, index);
}

void Interface::FITKAbaAmplitudeTabular::setAmplitude(double value, int index)
{
    m_data.setAmplitude(value, index);
}

int Interface::FITKAbaAmplitudeTabular::getNumberOfRowsOfMultipleIntervals() const
{
    return m_data.getNumberOfRowsOfMultipleIntervals();
}

void Interface::FITKAbaAmplitudeTabular::setNumberOfRowsOfMultipleIntervals(int rowCount)
{
    m_data.setNumberOfRowsOfMultipleIntervals(rowCount);
}

void Interface::FITKAbaAmplitudeTabular::removeRowOfMultipleIntervals(int index)
{
    m_data.removeRowOfMultipleIntervals(index);
}

void Interface::FITKAbaAmplitudeTabular::insertRowOfMultipleIntervals(double value, int index)
{
    m_data.insertRowOfMultipleIntervals(value, index);
}

double Interface::FITKAbaAmplitudeTabular::getMultipleInterval(int index) const
{
    return m_data.getMultipleInterval(index);
}

void Interface::FITKAbaAmplitudeTabular::setMultipleInterval(double value, int index)
{
    m_data.setMultipleInterval(value, index);
}

